﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace CommunitySystemModel
{
    [Serializable]
    [DataContract]
    public class Emp_ResumeModel
    {
        private int _ID;
        [DataMember]
        public int ID
        {
            get { return _ID; }
            set { _ID = value; }
        }

        private int _EmpBasicID;
        [DataMember]
        public int EmpBasicID
        {
            get { return _EmpBasicID; }
            set { _EmpBasicID = value; }
        }

        private DateTime? _BeginDate = null;
        [DataMember]
        public DateTime? BeginDate
        {
            get { return _BeginDate; }
            set { _BeginDate = value; }
        }

        private DateTime? _EndDate = null;
        [DataMember]
        public DateTime? EndDate
        {
            get { return _EndDate; }
            set { _EndDate = value; }
        }

        private string _Unit = string.Empty;
        [DataMember]
        public string Unit
        {
            get { return _Unit; }
            set { _Unit = value; }
        }

        private string _Duty = string.Empty;
        [DataMember]
        public string Duty
        {
            get { return _Duty; }
            set { _Duty = value; }
        }

        private string _Witness = string.Empty;
        [DataMember]
        public string Witness
        {
            get { return _Witness; }
            set { _Witness = value; }
        }

        private bool _IsPeriod = false;
        [DataMember]
        public bool IsPeriod
        {
            get { return _IsPeriod; }
            set { _IsPeriod = value; }
        }

        private string _IsPeriodString = string.Empty;
        [DataMember]
        public string IsPeriodString
        {
            get { return _IsPeriodString; }
            set { _IsPeriodString = value; }
        }

        private string _EmpName = string.Empty;
        [DataMember]
        public string EmpName
        {
            get { return _EmpName; }
            set { _EmpName = value; }
        }

        private string _EmpNo = string.Empty;
        [DataMember]
        public string EmpNo
        {
            get { return _EmpNo; }
            set { _EmpNo = value; }
        }

        private int _WAiID;
        [DataMember]
        public int WAiID
        {
            get { return _WAiID; }
            set { _WAiID = value; }
        }
        private string _JL = string.Empty;
        [DataMember]
        public string JL
        {
            get { return _JL; }
            set { _JL = value; }
        }
        private string _SID = string.Empty;
        [DataMember]
        public string SID
        {
            get { return _SID; }
            set { _SID = value; }
        }
        private string _JCGZNX = string.Empty;
        [DataMember]
        public string JCGZNX
        {
            get { return _JCGZNX; }
            set { _JCGZNX = value; }
        }
        public static Emp_ResumeModel FillEntity(DataRow dr)
        {
            Emp_ResumeModel right = new Emp_ResumeModel();
            if (dr.Table != null && dr.Table.Columns.Contains("WAiID")) if (!string.IsNullOrEmpty(dr["WAiID"].ToString())) right.WAiID = Convert.ToInt32(dr["WAiID"]);
            if (!string.IsNullOrEmpty(dr["ID"].ToString()))
                right.ID = (int)dr["ID"];
            if (!string.IsNullOrEmpty(dr["EmpBasicID"].ToString()))
                right.EmpBasicID = (int)dr["EmpBasicID"];
            right.Unit = dr["Unit"] as string;
            right.Duty = dr["Duty"] as string;
            right.Witness = dr["Witness"] as string;
            right.EmpName = dr["EmpName"] as string;
            right.EmpNo = dr["EmpNo"] as string;
            if (!string.IsNullOrEmpty(dr["IsPeriod"].ToString())) right.IsPeriod = (bool)dr["IsPeriod"];
            right.BeginDate = (string.IsNullOrEmpty(dr["BeginDate"].ToString()) || dr["BeginDate"].ToString() == "1900/1/1 0:00:00" || Convert.ToDateTime(dr["BeginDate"]) == Convert.ToDateTime("1900-1-1")) ? null : (DateTime?)dr["BeginDate"];
            right.EndDate = (string.IsNullOrEmpty(dr["EndDate"].ToString()) || dr["EndDate"].ToString() == "1900/1/1 0:00:00" || Convert.ToDateTime(dr["EndDate"]) == Convert.ToDateTime("1900-1-1")) ? null : (DateTime?)dr["EndDate"];
            right.IsPeriodString = (string)dr["IsPeriodString"];
            if (dr.Table != null && dr.Table.Columns.Contains("jl"))
                right.JL = dr["jl"] as string;
            right.SID = dr["SID"] as string;
            right.JCGZNX = dr["JCGZNX"] as string;
            return right;
        }
    }
}
